<?php

class Company_gear extends Doctrine_Record {

    public function setTableDefinition() {
        $this->hasColumn('company_id', 'integer', 20);
        $this->hasColumn('model', 'string', 255);
        $this->hasColumn('device_type', 'string', 255);
        $this->hasColumn('ip', 'string', 255);
        $this->hasColumn('check_status', 'integer', 1);
        $this->hasColumn('lst_check', 'date');
        $this->hasColumn('monitoring_for_jobs', 'integer', 1);
        $this->hasColumn('meta_info', 'string', 1000);
    }

    public function setUp() {
        $this->actAs('Timestampable');
        $this->hasMany('Alert as Alerts', array(
            'local' => 'id',
            'foreign' => 'company_gear_id',
            'onDelete' => 'CASCADE'
                ) 
        );
        $this->hasOne('Company', array(
            'local' => 'company_id',
            'foreign' => 'id',
            'onDelete' => 'CASCADE'
                )
        );
        $this->hasMany('Act_computer as Act_computers', array(
            'local' => 'id',
            'foreign' => 'company_gear_id'
                )
        );
        $this->hasMany('Support as Supports', array(
            'local' => 'id',
            'foreign' => 'support_id',
            'onDelete' => 'CASCADE'
        ));
    }

}

